import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/components/Layout.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/dashboard'
  },
  {
    path: '/dashboard',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Dashboard',
        component: () => import('@/views/Dashboard.vue'),
        meta: { title: '首页' }
      }
    ]
  },
  {
    path: '/data-center',
    component: Layout,
    children: [
      {
        path: '',
        name: 'DataCenter',
        component: () => import('@/views/DataCenter.vue'),
        meta: { title: '数据中心' }
      },
      {
        path: 'building-management',
        name: 'BuildingManagement',
        component: () => import('@/views/data/BuildingManagement.vue'),
        meta: { title: '楼栋管理' }
      },
      {
        path: 'parking-management',
        name: 'ParkingManagement',
        component: () => import('@/views/data/ParkingManagement.vue'),
        meta: { title: '车位管理' }
      },
      {
        path: 'homeowner-management',
        name: 'HomeownerManagement',
        component: () => import('@/views/data/HomeownerManagement.vue'),
        meta: { title: '业主管理' }
      },
      {
        path: 'add-homeowner',
        name: 'AddHomeowner',
        component: () => import('@/views/data/AddHomeowner.vue'),
        meta: { title: '添加业主' }
      },
      {
        path: 'tenant-management',
        name: 'TenantManagement',
        component: () => import('@/views/data/TenantManagement.vue'),
        meta: { title: '租客管理' }
      },
      {
        path: 'visitor-management',
        name: 'VisitorManagement',
        component: () => import('@/views/data/VisitorManagement.vue'),
        meta: { title: '访客管理' }
      },
      {
        path: 'advertising-management',
        name: 'AdvertisingManagement',
        component: () => import('@/views/data/AdvertisingManagement.vue'),
        meta: { title: '广告位管理' }
      },
      {
        path: 'car-management',
        name: 'CarManagement',
        component: () => import('@/views/data/CarManagement.vue'),
        meta: { title: '车辆管理' }
      },
    ]
  },
  {
    path: '/revenue-management',
    component: Layout,
    children: [
      {
        path: '',
        name: 'RevenueManagement',
        component: () => import('@/views/RevenueManagement.vue'),
        meta: { title: '收费管理' }
      },
      {
        path: 'unpaid-bill',
        name: 'UnpaidBill',
        component: () => import('@/views/charge/UnpaidBill.vue'),
        meta: { title: '未缴账单' }
      },
      {
        path: 'payment-notice',
        name: 'PaymentNotice',
        component: () => import('@/views/charge/PaymentNotice.vue'),
        meta: { title: '未缴账单' }
      },
      {
        path: 'paid-bill',
        name: 'PaidBill',
        component: () => import('@/views/charge/PaidBill.vue'),
        meta: { title: '已缴账单' }
      },
      {
        path: 'prepaid-management',
        name: 'PrepaidManagement',
        component: () => import('@/views/charge/PrepaidManagement.vue'),
        meta: { title: '预存款管理' }
      },
      {
        path: 'charge-setting',
        name: 'ChargeSetting',
        component: () => import('@/views/charge/ChargeSetting.vue'),
        meta: { title: '预存款管理' }
      },
      {
        path: '/bill/detail',
        name: 'BillDetail',
        component: () => import('@/views/bill/BillDetail.vue'),
        meta: { title: '账单详情' }
      },
      {
        path: '/bill/refund',
        name: 'RefundForm',
        component: () => import('@/views/bill/RefundForm.vue'),
        meta: { title: '退款申请' }
      },
      {
        path: '/bill/print',
        name: 'PrintPreview',
        component: () => import('@/views/bill/PrintPreview.vue'),
        meta: { title: '打印预览' }
      }
    ]
  },
  {
    path: '/property-service',
    component: Layout,
    children: [
      {
        path: '',
        name: 'PropertyService',
        component: () => import('@/views/PropertyService.vue'),
        meta: { title: '物业服务' }
      },
      {
        path: 'repair-mgmt',
        name: 'RepairMgmt',
        component: () => import('@/views//propertyS/RepairMgmt.vue'),
        meta: { title: '报事报修' }
      },
      {
        path: 'complaint-mgmt',
        name: 'ComplaintMgmt',
        component: () => import('@/views//propertyS/ComplaintMgmt.vue'),
        meta: { title: '投诉管理' }
      },
      {
        path: 'decoration',
        name: 'Decoration',
        component: () => import('@/views//propertyS/Decoration.vue'),
        meta: { title: '装修管理' }
      },
      {
        path: 'survey',
        name: 'Survey',
        component: () => import('@/views//propertyS/Survey.vue'),
        meta: { title: '问卷调查' }
      }
    ]
  },

  {
    path: '/customer-management',
    component: Layout,
    children: [
      {
        path: '',
        name: 'CustomerManagement',
        component: () => import('@/views/CustomerManagement.vue'),
        meta: { title: '租赁管理' }
      },
      {
        path: 'vehicle-space',
        name: 'VehicleSpace',
        component: () => import('@/views/customer/VehicleSpace.vue'),
        meta: { title: '车位租赁' }
      }, {
        path: '/customer-management/vehicle-space/detail',
        name: 'ParkingLeaseDetail',
        component: () => import('@/views/customer/Info/ParkingLeaseById.vue'),
        meta: { title: '车位租赁详情' }
      },

      {
        path: 'vehicle-space/add-parking-lease',
        name: 'AddParkingLease',
        component: () => import('@/views/customer/Info/AddParkingLease.vue'),
        meta: { title: '添加车位租赁合同' }
      },
      {
        path: 'advertising-space',
        name: 'AdvertisingSpace',
        component: () => import('@/views/customer/AdvertisingSpace.vue'),
        meta: { title: '广告位租赁' }
      },
      {
        path: '/customer-management/advertising-space/detail',
        name: 'AdvertisingLeaseDetail',
        component: () => import('@/views/customer/Info/AdvertisingSpaceById.vue'),
        meta: { title: '广告位租赁详情' }
      },
      {
        path: 'vehicle-space/add-advertising-lease',
        name: 'AddAdvertisingLease',
        component: () => import('@/views/customer/Info/AddAdvertisingLease.vue'),
        meta: { title: '新增广告位租赁' }
      },
      {
        path: 'housing-lease',
        name: 'HousingLease',
        component: () => import('@/views/customer/HousingLease.vue'),
        meta: { title: '房屋租赁' }
      },
      {
        path: '/customer-management/housing-lease/detail',
        name: 'RoomLeaseDetail',
        component: () => import('@/views/customer/Info/RoomLeaseDetail.vue'),
        meta: { title: '房屋租赁详情' }
      },
      {
        path: '/house-contract-add',
        name: 'AddRoomLease',
        component: () => import('@/views/customer/Info/AddRoomLease.vue'),
        meta: { title: '新增房屋租赁' }
      },

      {
        path: 'contract-management',
        name: 'ContractManagement',
        component: () => import('@/views/customer/ContractManagement.vue'),
        meta: { title: '合同管理' }
      }
    ]
  },
  {
    path: '/property-management',
    component: Layout,
    children: [
      {
        path: '',
        name: 'PropertyManagement',
        component: () => import('@/views/PropertyManagement.vue'),
        meta: { title: '物料管理' }
      },
      {
        path: 'suppliers',
        name: 'SupplierList',
        component: () => import('@/views/SupplierList.vue'),
        meta: { title: '供应商管理' }
      },
      {
        path: 'warehouse-management',
        name: 'WarehouseManagement',
        component: () => import('@/views/propertyM/WarehouseManagement.vue'),
        meta: { title: '仓库管理' }
      },
      {
        path: 'material-list',
        name: 'MaterialList',
        component: () => import('@/views/propertyM/MaterialList.vue'),
        meta: { title: '物料清单' }
      },
      {
        path: 'in-waregouse',
        name: 'InWaregouse',
        component: () => import('@/views/propertyM/InWaregouse.vue'),
        meta: { title: '采购入库' }
      },
      {
        path: 'add-bound',
        name: 'AddBound',
        component: () => import('@/views/propertyM/AddBound.vue'),
        meta: { title: '新增入库' }
      },
      {
        path: 'out-warehouse',
        name: 'OutWarehouse',
        component: () => import('@/views/propertyM/OutWarehouse.vue'),
        meta: { title: '领用出库' }
      },
      {
        path: 'add-outbound',
        name: 'AddOutbound',
        component: () => import('@/views/propertyM/AddOutbound.vue'),
        meta: { title: '新增出库' }
      },
      {
        path: 'inventory-query',
        name: 'InventoryQuery',
        component: () => import('@/views/propertyM/InventoryQuery.vue'),
        meta: { title: '库存查询' }
      }
    ]
  },
  {
    path: '/equipment-management',
    component: Layout,
    children: [
      {
        path: '',
        name: 'EquipmentManagement',
        component: () => import('@/views/EquipmentManagement.vue'),
        meta: { title: '设备管理' }
      },
      {
        path: 'add-equipment',
        name: 'AddEquipment',
        component: () => import('@/views/equipment/AddEquipment.vue'),
        meta: { title: '新增设备' }
      },
      {
        path: 'equipment-detail/:id',
        name: 'EquipmentDetail',
        component: () => import('@/views/equipment/EquipmentDetail.vue'),
        meta: { title: '设备详情' }
      },
      {
        path: 'maintenance-plan',
        name: 'MaintenancePlan',
        component: () => import('@/views/equipment/MaintenancePlan.vue'),
        meta: { title: '保养计划' },
      },
      {
        path: 'maintenance-plan-form',
        name: 'MaintenancePlanForm',
        component: () => import('@/views/equipment/MaintenancePlanForm.vue'),
        meta: { title: '制定保养计划' },
      },
      {
        path: 'maintenance-record',
        name: 'MaintenanceRecord',
        component: () => import('@/views/equipment/MaintenanceRecord.vue'),
        meta: { title: '保养记录' }
      },
      {
        path: 'add-maintenance-record',
        name: 'AddMaintenanceRecord',
        component: () => import('@/views/equipment/AddMaintenanceRecord.vue'),
        meta: { title: '新增保养记录' }
      },
      {
        path: 'edit-maintenance-record/:id',
        name: 'EditMaintenanceRecord',
        component: () => import('@/views/equipment/EditMaintenanceRecord.vue'),
        meta: { title: '修改保养记录' }
      },
      {
        path: 'equipment-maintenance',
        name: 'EquipmentMaintenance',
        component: () => import('@/views/EquipmentMaintenance.vue'),
        meta: { title: '设备维修' }
      },
      {
        path: 'maintenance-record-detail/:id',
        name: 'MaintenanceRecordDetail',
        component: () => import('@/views/equipment/MaintenanceRecordDetail.vue'),
        meta: { title: '维修记录详情' }
      }
    ]
  },
  {
    path: '/income-expense',
    component: Layout,
    children: [
      {
        path: '',
        name: 'IncomeExpense',
        component: () => import('@/views/IncomeExpense.vue'),
        meta: { title: '收益管理' }
      }
    ]
  },
  {
    path: '/statistics',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Statistics',
        component: () => import('@/views/Statistics.vue'),
        meta: { title: '统计分析' }
      }
    ]
  },
  {
    path: '/system-management',
    component: Layout,
    children: [
      {
        path: '',
        name: 'SystemManagement',
        component: () => import('@/views/SystemManagement.vue'),
        meta: { title: '系统管理' }
      }
    ]
  },
  {
    path: '/payment/success',
    name: 'PaymentSuccess',
    component: () => import('@/PaySuccess.vue')
  },


]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router